<%-- 
    Document   : ModificarUsuario
    Created on : 13/06/2008, 09:09:12 PM
    Author     : Alejandro
--%>

<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page language="java" import="com.akcess.vo.*" %>
<%@ page language="java" import="manejadores.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
    <!--  Version: Multiflex-3.12 / Overview                    --><!--  Date:    January 20, 2008                             --><!--  Design:  www.1234.info                                --><!--  License: Fully open source without restrictions.      --><!--           Please keep footer credits with the words    --><!--           "Design by 1234.info" Thank you!             -->
    <script language="JavaScript">	
        <!--
        function evalua(formulario) {
                
            var nroDoc = formulario.NroDoc.value;
            var nombre = formulario.Nombre.value;
            var apellido = formulario.Apellido.value;
            var nombreO = formulario.NombreOperativo.value;
                
            //var tipodoc = formulario.idtipodoc.value;
            var banda = 1;
                                
            if (confirm("¿Está seguro?")) {
                                                             
                //alert("x"+nombre+"x");
                if (nroDoc == "") {
                    alert("El campo --Número de Documento-- \n NO puede quedar vacío");
                    banda = 0;
                }
                
                if (nombre == "") {
                    alert("El campo --Nombre-- \n NO puede quedar vacío");
                    banda = 0;
                }
                
                if (apellido == "") {
                    alert("El campo --Apellido-- \n NO puede quedar vacío");
                    banda = 0;
                }
                
                if (nombreO == "") {
                    alert("El campo --Nombre Operativo-- \n NO puede quedar vacío");
                    banda = 0;
                }
                
                if (banda == 1)
                    formulario.submit();
            }
            else {
                alert("Por favor, modifique los campos que quiera...");
            }
        }
        
        
        //-->
    </script>
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="3600">
    <meta name="revisit-after" content="2 days">
    <meta name="robots" content="index,follow">
    <meta name="publisher" content="Your publisher infos here ...">
    <meta name="copyright" content="Your copyright infos here ...">
    <meta name="author" content="Design: 1234.info / Modified: Your Name">
    <meta name="distribution" content="global">
    <meta name="description" content="Your page description here ...">
    <meta name="keywords" content="Your keywords, keywords, keywords, here ...">
    <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_setup.css">
    <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_text.css">
<link rel="icon" type="image/x-icon" href="./img/favicon.ico"><title>SRR - Sistema de Reserva de Recursos</title><!-- Global IE fix to avoid layout crash when single word size wider than column width --><!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]--><link href="./css/highlighter.css" type="text/css" rel="stylesheet"><link href="./css/highlighter_002.css" type="text/css" rel="stylesheet"></head><body>
<!-- Main Page Container -->
<div class="page-container">
    
    <!-- For alternative headers START PASTE here -->

    <!-- A. HEADER -->      
            <jsp:include page="../Header.jsp"/>
            
            <!-- For alternative headers END PASTE here -->

    <!-- B. MAIN -->
    <div class="main">
        
        <!-- B.1 MAIN NAVIGATION -->
        <jsp:include page="../barraOperaciones.jsp"/> 
        
        <!-- B.2 MAIN CONTENT -->
        <div class="main-content">
            
            <!-- Pagetitle -->
            <%
            String hacer = request.getParameter("hacer");
            int idUser;
            if (hacer != null && hacer.equals("Perfil")) {
                out.println("<h1 class=\"pagetitle\">Modificar Usuario " + request.getAttribute("nombreUser") + "</h1>");
                idUser = Integer.parseInt(request.getAttribute("id").toString());
                out.println("<form name=\"crear\" action=\"SessionLogin?hacer=modificacion&id=" + idUser + "\" method=\"post\">");
            } else {
                out.println("<h1 class=\"pagetitle\">Modificar Usuario " + request.getParameter("nombreUser") + "</h1>");
                idUser = Integer.parseInt(request.getParameter("id"));
                out.println("<form name=\"crear\" action=\"GestionarUsuarios?hacer=modificacion&id=" + idUser + "\" method=\"post\">");
            }

            Connection cone;
            cone = (Connection) session.getAttribute("conexion");
            ManejadorUsuarios manejador = new ManejadorUsuarios(cone);
            Usuarios user = manejador.ObtenerUsuario(idUser);
            out.println("<table border=\"0\">");
            out.println("<tbody>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Nombre</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Nombre\" value=\"" + user.getNombre() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Apellido</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Apellido\" value=\"" + user.getApellido() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Nombre Operativo</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"NombreOperativo\" value=\"" + user.getNombreoperativo() + "\"></td>");
            out.println("</tr>");

            if (hacer != null && hacer.equals("Perfil")) {
                out.println("<tr>");
                out.println("<th class=\"top\"><b>Contraseña</b></th>");
                out.println("<td aling=\"center\"><input type=\"password\" name=\"Contrasena\" value=\"" + user.getContrasena() + "\"></td>");
                out.println("</tr>");
            }

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Nro. Doc.</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"NroDoc\" value=\"" + user.getNrodoc() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Email</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Email\" value=\"" + user.getEmail() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Telefono</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Telefono\" value=\"" + user.getTelefono() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Celular</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Celular\" value=\"" + user.getCelular() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Fax</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Fax\" value=\"" + user.getFax() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Direccion</b></th>");
            out.println("<td aling=\"center\"><input type=\"text\" name=\"Direccion\" value=\"" + user.getDireccion() + "\"></td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Observacion</b></th>");
            out.println("<td aling=\"center\"><textarea name=\"Observacion\" cols=\"15\" rows=\"5\" >" + user.getObservacion() + "</textarea></td>");
            out.println("</tr>");

            out.println("</tbody>");
            out.println("</table>");

            %>       
            </tbody>
            </table>            
            <table>
                <tbody>
                    <tr>
                        <td>                            
                            <center><input type="button" name="btnGuardar" value="Guardar" onclick="evalua(this.form)"></center>                                    
                        </td>
                        <td>
                            <%
            if (hacer != null && hacer.equals("Perfil")) {
                out.println("<center><input type=\"button\" name=\"btnCancelar\" value=\"Cancelar\" onclick=\"location.href = './'\"></center>");
            } else {
                out.println("<center><input type=\"button\" name=\"btnCancelar\" value=\"Cancelar\" onclick=\"location.href = 'GestionarUsuarios?hacer=Modificar'\"></center>");
            }

                            %>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>            
        </div>        
        <!-- B.3 SUBCONTENT -->        
    </div>    
    <!-- C. FOOTER AREA -->   
    <%@include file="../footer.jsp"%>     
</div> 
</body>
</html>